# -*- coding: utf-8 -*-

from toquinitem import ToquinItem

class Toquin:
    installables = None

    def __init__(self):
        self.installables = {}

    def addItem(self, toquinItem):
        self.installables[toquinItem] = False

    def markForInstallation(self, toquinItem):
        if toquinItem in self.installables.keys():
            self.installables[toquinItem] = True
        else:
            raise LookupError

    def unmarkForInstallation(self, toquinItem):
        if toquinItem in self.installables.keys():
            self.installables[toquinItem] = False
        else:
            raise LookupError

    def getItems(self):
        return self.installables.keys()

    def getKit(self, kit):
        return filter(lambda x : x.iskit, self.getCategory(kit))
    
    def getCategory(self, category):
        return filter(lambda x : x.category == category, self.installables.keys())
        
    def getMarkedForInstallation(self):
        return filter(lambda x : self.installables[x], self.installables.keys())

    def isMarkedForInstallation(self, toquinItem):
        return self.installables[toquinItem]
